package com.cherrish.rest;

import com.cherrish.feign.PermissionClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Set;

/**
 * @author cherrish
 * @time 2018-09-04 15:28
 * @name PermissionController
 * @desc:
 */
@RestController
@RequestMapping("/permissions")
public class PermissionController {

    @Autowired
    private PermissionClient permissionClient;

    @GetMapping("/current")
    public Object permissionsCurrent(){
        return permissionClient.permissionsCurrent();
    }

    @GetMapping("/all")
    public Object permissionsAll(){
        return permissionClient.permissionsAll();
    }

    @GetMapping("/parents")
    public Object parents(){
        return permissionClient.parentMenu();
    }

    @GetMapping(params = "roleId")
    public Object listByRoleId(Long roleId ){
        return permissionClient.listByRoleId(roleId);
    }

    @GetMapping("/owns")
    public Set<String> ownsPermission() {
        return permissionClient.ownsPermission();
    }




}
